import 'package:flutter/material.dart';
import 'package:my_app/uitls/custom_appbar.dart';
import 'package:my_app/uitls/global.dart';

class ExampleWidgetsList extends StatelessWidget {
  // final Object args;

  // ExampleWidgetsList({required this.args});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color(0xFFFFFFFF),
      appBar: customAppBar(
        title: '组件列表',
        context: context,
      ),
      body: SingleChildScrollView(
        child: Container(
          padding: EdgeInsets.symmetric(horizontal: 15),
          child: Column(
            children: [
              returnRow(
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text('AButton'),
                  ],
                ),
                onPress: () =>
                    Navigator.pushNamed(context, '/example_abutton'),
              ),
            ],
          ),
        ),
      ),
    );
  }

  InkWell returnRow({required Widget child, Function? onPress}) {
    return InkWell(
      onTap: onPress == null ? () {} : () => onPress(),
      child: Container(
        padding: EdgeInsets.symmetric(vertical: 15),
        decoration: BoxDecoration(
          border: G.borderBottom(),
        ),
        child: child,
      ),
    );
  }
}
